﻿using sixgod.Common.Model;
using sixgod.Dtos.System;
using sixgod.Model.System;
using sixgod.Model.System.Dictionary;
using SqlSugar;

namespace sixgod.Service.Dictionary;

public interface IDictionaryService:ISimpleClient<SystemDictionary>
{
    /// <summary>
    /// 字典服务初始化
    /// </summary>
    /// <returns></returns>
    Task Init();

    /// <summary>
    /// 从缓存获取所有字典类型
    /// </summary>
    /// <returns></returns>
    Task<List<SystemDictionary>> GetList();

    /// <summary>
    /// 获取分页数据
    /// </summary>
    /// <param name="search"></param>
    /// <returns></returns>
    Task<PageResponseResult<DictionaryDto>> GetPageList(DicQueryModel search);

    /// <summary>
    /// 通过字典主键获取字典项
    /// </summary>
    /// <param name="code">字典类型主键</param>
    /// <returns></returns>
    Task<List<DicItemDto>> GetItemList(string code);

    /// <summary>
    /// 通过字典类型获取字典项
    /// </summary>
    /// <param name="code">字典类型</param>
    /// <returns></returns>
    Task<List<DictionaryItem>> GetDicItemList(string code);

    /// <summary>
    /// 插入数据
    /// </summary>
    /// <param name="dictionary"></param>
    /// <returns></returns>
    Task<bool> InsertSystemDictionaryAsync(SystemDictionary dictionary);

    /// <summary>
    /// 更新数据
    /// </summary>
    /// <param name="dictionary"></param>
    /// <returns></returns>
    Task<bool> UpdateSystemDictionaryAsync(SystemDictionary dictionary);

    /// <summary>
    /// 删除
    /// </summary>
    /// <param name="code"></param>
    /// <returns></returns>
    Task<bool> DeleteSystemDictionaryAsync(string code);

    /// <summary>
    /// 获取字典项
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="code">字典类型代码</param>
    /// <returns></returns>
    Task<List<DicItemDto>> GetDicList(string code);

    /// <summary>
    /// 新增字典项
    /// </summary>
    /// <param name="item"></param>
    /// <returns></returns>
    Task<bool> InsertSystemDictionaryItemAsync(DictionaryItem item);

    /// <summary>
    /// 更新字典项
    /// </summary>
    /// <param name="item"></param>
    /// <returns></returns>
    Task<bool> UpdateSystemDictionaryItemAsync(DictionaryItem item);

    /// <summary>
    /// 删除字典项
    /// </summary>
    /// <param name="code"></param>
    /// <returns></returns>
    Task<bool> DeleteSystemDictionaryItemAsync(string code);
}